/*
 * validandoDecimales.java
 *
 * Created on 1 de octubre de 2007, 09:33 PM
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */

package score.utils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;


public class validadoresComunes {
    
    public validadoresComunes() {
    }
    
    public boolean validandoDecimales(String decimal){
       // Pattern pattern = Pattern.compile("^(-|)(((\\d{1,3})(,\\d{3})*)|(\\d+))(.\\d+)?$");  //set the Regluar Expression
        // Pattern pattern = Pattern.compile("^([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,2})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,2})?|0(\\.[0-9]{0,2})?|(\\.[0-9]{1,2})?)$");  //set the Regluar Expression
        //Pattern pattern = Pattern.compile("^([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,3})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,3})?|0(\\.[0-9]{0,3})?|(\\.[0-9]{1,3})?|(\\.[0-9]{2,3})?)$");  //set the Regluar Expression
        Pattern pattern = Pattern.compile("^(-|)([1-9]{1}[0-9]{0,2}(\\,[0-9]{3})*(\\.[0-9]{0,4})?|[1-9]{1}[0-9]{0,}(\\.[0-9]{0,4})?|0(\\.[0-9]{0,4})?|(\\.[0-9]{1,4})?|(\\.[0-9]{2,4})?|(\\.[0-9]{3,4})?)$");  //set the Regluar Expression
            Matcher matcher = pattern.matcher(decimal);  //validate the input
            if(matcher.matches())
                return true;
            else
                return false;
    }
    
      public boolean validandoCaracteresRaros(String str){
          //if((str.contains(" "))||(str.contains("!"))||(str.contains("\""))||(str.contains("#"))||(str.contains("$"))||(str.contains("%"))||(str.contains("&"))||(str.contains("/"))||(str.contains("("))||(str.contains(")")))
          Pattern pattern = Pattern.compile("^[a-zA-Z0-9]+$");  //set the Regluar Expression
          Matcher matcher = pattern.matcher(str);  //validate the input
            if(matcher.matches())
                return false;
            else
                return true;
    }
}
